package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDate;
import java.util.List;

@TableName("t_forumPosts")
public class PostsBean {
    /**
     * 主贴ID
     */
    @TableId(value = "pk_postsId",type = IdType.AUTO)
    private Integer id;
    /**
     * 主贴的主题
     */
    @TableField("p_theme")
    private String theme;
    /**
     * 主贴内容
     */
    @TableField("p_content")
    private String content;
    /**
     * 发帖日期
     */
    @TableField("p_wDate")
    private LocalDate wDate=LocalDate.now();

    /**
     * 发帖人
     */
    @TableField(exist = false)
    private UserBean writer;
    /**
     * 所属频道
     */

    @TableField(exist = false)
    private List<ReplayBean> replays;
    /**
     * 回复数
     */
    @TableField(exist = false)
    private Integer replayNum;
    @TableField("fk_channelId")
    private Integer channelId;
    @TableField("fk_userId")
    private Integer writerId;

    public PostsBean() {
    }

    public PostsBean(String theme, String content,Integer writerId,Integer channelId) {
        this.theme = theme;
        this.content = content;
        this.writerId = writerId;
        this.channelId=channelId;
    }

    public void setReplays(List<ReplayBean> replays) {
        this.replays = replays;
    }

    public Integer getReplayNum() {
        return replayNum;
    }

    public void setReplayNum(Integer replayNum) {
        this.replayNum = replayNum;
    }

    public Integer getChannelId() {
        return channelId;
    }

    public void setChannelId(Integer channelId) {
        this.channelId = channelId;
    }

    public List<ReplayBean> getReplays() {
        return replays;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTheme() {
        return theme;
    }

    public void setTheme(String theme) {
        this.theme = theme;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public LocalDate getwDate() {
        return wDate;
    }

    public void setwDate(LocalDate wDate) {
        this.wDate = wDate;
    }

    public UserBean getWriter() {
        return writer;
    }

    public void setWriter(UserBean writer) {
        this.writer = writer;
    }

    public Integer getWriterId() {

        return writerId;
    }

    public void setWriterId(Integer writerId) {
        this.writerId = writerId;
    }

    @Override
    public String toString() {
        return "PostsBean{" +
                "id=" + id +
                ", theme='" + theme + '\'' +
                ", content='" + content + '\'' +
                ", wDate=" + wDate +
                ", writer=" + writer +
                ", replays=" + replays +
                ", replayNum=" + replayNum +
                ", channelId=" + channelId +
                "}\n";
    }
}
